<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>DataExtractor: E:/cas/cas.0.7.0/sfw/src/MinConsole/MinConsole.0.8.0/MinConsole/Gaf/Utils/INI/SectionDataCollection.cs Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<link href="../../doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../namespaces.html"><span>Packages</span></a></li>
      <li><a href="../../annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="../../files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>E:/cas/cas.0.7.0/sfw/src/MinConsole/MinConsole.0.8.0/MinConsole/Gaf/Utils/INI/SectionDataCollection.cs</h1>  </div>
</div>
<div class="contents">
<a href="../../d9/d62/SectionDataCollection_8cs.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="keyword">using</span> System;
<a name="l00002"></a>00002 <span class="keyword">using</span> System.Collections;
<a name="l00003"></a>00003 <span class="keyword">using</span> System.Collections.Generic;
<a name="l00004"></a>00004 
<a name="l00005"></a>00005 <span class="keyword">namespace </span>MinConsole.IniParser
<a name="l00006"></a>00006 {
<a name="l00010"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html">00010</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html" title="Represents a collection of SectionData.">SectionDataCollection</a> : ICloneable, IEnumerable&lt;SectionData&gt;
<a name="l00011"></a>00011     {
<a name="l00012"></a>00012 <span class="preprocessor">        #region Initialization</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span>
<a name="l00017"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a4eb0cc569a80862761f45b8ea7b6dfb6">00017</a>         <span class="keyword">public</span> <a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html" title="Represents a collection of SectionData.">SectionDataCollection</a>()
<a name="l00018"></a>00018         {
<a name="l00019"></a>00019             _sectionData = <span class="keyword">new</span> Dictionary&lt;string, SectionData&gt;();
<a name="l00020"></a>00020         }
<a name="l00021"></a>00021 
<a name="l00032"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a5cd72474f35e81fea789a6cec831369b">00032</a>         <span class="keyword">public</span> <a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html" title="Represents a collection of SectionData.">SectionDataCollection</a>(<a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html" title="Represents a collection of SectionData.">SectionDataCollection</a> ori)
<a name="l00033"></a>00033         {
<a name="l00034"></a>00034             _sectionData = <span class="keyword">new</span> Dictionary&lt;string, SectionData&gt; (ori.<a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a52a5d6046c6af935aba7db7ffe5024fc" title="Data associated to this section.">_sectionData</a>);
<a name="l00035"></a>00035         }
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 <span class="preprocessor">        #endregion</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span>
<a name="l00039"></a>00039 <span class="preprocessor">        #region Properties</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00044"></a>00044         <span class="keyword">public</span> <span class="keywordtype">int</span> Count
<a name="l00045"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#aad462966ed963f892117056de1eba502">00045</a>         {
<a name="l00046"></a>00046             <span class="keyword">get</span> { <span class="keywordflow">return</span> _sectionData.<a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#aad462966ed963f892117056de1eba502" title="Returns the number of SectionData elements in the collection.">Count</a>; }
<a name="l00047"></a>00047         }
<a name="l00048"></a>00048 
<a name="l00055"></a>00055         <span class="keyword">public</span> <a class="code" href="../../d3/db1/classMinConsole_1_1IniParser_1_1KeyDataCollection.html" title="Represents a collection of Keydata.">KeyDataCollection</a> <span class="keyword">this</span>[<span class="keywordtype">string</span> sectionName]
<a name="l00056"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a650b8497f94ec1c92041a631921f7fc0">00056</a>         {
<a name="l00057"></a>00057             <span class="keyword">get</span>
<a name="l00058"></a>00058             {
<a name="l00059"></a>00059                 <span class="keywordflow">if</span> ( _sectionData.ContainsKey(sectionName) )
<a name="l00060"></a>00060                     <span class="keywordflow">return</span> _sectionData[sectionName].Keys;
<a name="l00061"></a>00061 
<a name="l00062"></a>00062                 <span class="keywordflow">return</span> null;
<a name="l00063"></a>00063             }
<a name="l00064"></a>00064         }
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 <span class="preprocessor">        #endregion</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span>
<a name="l00068"></a>00068 <span class="preprocessor">        #region Public Members</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span>
<a name="l00081"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#ad321519caa7c680485c652a6de4986bd">00081</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> AddSection(<span class="keywordtype">string</span> keyName)
<a name="l00082"></a>00082         {
<a name="l00083"></a>00083             <span class="comment">//Checks valid section name</span>
<a name="l00084"></a>00084             <span class="keywordflow">if</span> ( !<a class="code" href="../../d7/db7/classMinConsole_1_1IniParser_1_1Assert.html">Assert</a>.<a class="code" href="../../d7/db7/classMinConsole_1_1IniParser_1_1Assert.html#ac82a480b8df17b2688416cb1443a30ed" title="Asserts that a strings has no blank spaces.">StringHasNoBlankSpaces</a>(keyName) )
<a name="l00085"></a>00085                 <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentException(<span class="stringliteral">&quot;Key name is not valid&quot;</span>);
<a name="l00086"></a>00086 
<a name="l00087"></a>00087             <span class="keywordflow">if</span> ( !ContainsSection(keyName) )
<a name="l00088"></a>00088             {
<a name="l00089"></a>00089                 _sectionData.Add( keyName, <span class="keyword">new</span> <a class="code" href="../../da/d5e/classMinConsole_1_1IniParser_1_1SectionData.html" title="Information associated to a section in a INI FileIncludes both the value and the comments associated ...">SectionData</a>(keyName) );
<a name="l00090"></a>00090                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00091"></a>00091             }
<a name="l00092"></a>00092 
<a name="l00093"></a>00093             <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00094"></a>00094         }
<a name="l00095"></a>00095 
<a name="l00104"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a91e0744d791d10b18057058e410943e6">00104</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> ContainsSection(<span class="keywordtype">string</span> keyName)
<a name="l00105"></a>00105         {
<a name="l00106"></a>00106             <span class="keywordflow">return</span> _sectionData.<a class="code" href="../../d3/db1/classMinConsole_1_1IniParser_1_1KeyDataCollection.html#a69401762b8087d1a2b9b267b4a3eee8f" title="Gets if a specifyed key name exists in the collection.">ContainsKey</a>(keyName);
<a name="l00107"></a>00107         }
<a name="l00108"></a>00108 
<a name="l00117"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a0bc57065ca25c4237925dd5f63478c07">00117</a>         <span class="keyword">public</span> <a class="code" href="../../da/d5e/classMinConsole_1_1IniParser_1_1SectionData.html" title="Information associated to a section in a INI FileIncludes both the value and the comments associated ...">SectionData</a> GetSectionData(<span class="keywordtype">string</span> sectionName)
<a name="l00118"></a>00118         {
<a name="l00119"></a>00119             <span class="keywordflow">if</span> (_sectionData.ContainsKey(sectionName))
<a name="l00120"></a>00120                 <span class="keywordflow">return</span> _sectionData[sectionName];
<a name="l00121"></a>00121 
<a name="l00122"></a>00122             <span class="keywordflow">return</span> null;
<a name="l00123"></a>00123         }
<a name="l00124"></a>00124 
<a name="l00125"></a>00125 
<a name="l00131"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a2b62ea8469d7958d6c7973c2550e093b">00131</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SetSectionData( <span class="keywordtype">string</span> sectionName, <a class="code" href="../../da/d5e/classMinConsole_1_1IniParser_1_1SectionData.html" title="Information associated to a section in a INI FileIncludes both the value and the comments associated ...">SectionData</a> data)
<a name="l00132"></a>00132         {
<a name="l00133"></a>00133             <span class="keywordflow">if</span> ( data != null )
<a name="l00134"></a>00134                 _sectionData[sectionName] = data;
<a name="l00135"></a>00135         }
<a name="l00136"></a>00136 
<a name="l00143"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#aa611edcbbe2657c78d72c5d89138eed4">00143</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> RemoveSection(<span class="keywordtype">string</span> keyName)
<a name="l00144"></a>00144         {
<a name="l00145"></a>00145             <span class="keywordflow">return</span> _sectionData.Remove(keyName);
<a name="l00146"></a>00146         }
<a name="l00147"></a>00147 
<a name="l00151"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#aa71d36872f416feaa853788a7a7a7ef8">00151</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> Clear()
<a name="l00152"></a>00152         {
<a name="l00153"></a>00153             _sectionData.Clear();
<a name="l00154"></a>00154         }
<a name="l00155"></a>00155 
<a name="l00156"></a>00156 <span class="preprocessor">        #endregion</span>
<a name="l00157"></a>00157 <span class="preprocessor"></span>
<a name="l00158"></a>00158 <span class="preprocessor">        #region IEnumerable&lt;SectionData&gt; Members</span>
<a name="l00159"></a>00159 <span class="preprocessor"></span>
<a name="l00166"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#ab016d15c7a22b1e701c68c98c0488f0b">00166</a>         <span class="keyword">public</span> IEnumerator&lt;SectionData&gt; GetEnumerator()
<a name="l00167"></a>00167         {
<a name="l00168"></a>00168             <span class="keywordflow">foreach</span> (<span class="keywordtype">string</span> sectionName <span class="keywordflow">in</span> _sectionData.Keys)
<a name="l00169"></a>00169                 yield <span class="keywordflow">return</span> _sectionData[sectionName];
<a name="l00170"></a>00170         }
<a name="l00171"></a>00171 
<a name="l00172"></a>00172 <span class="preprocessor">        #endregion</span>
<a name="l00173"></a>00173 <span class="preprocessor"></span>
<a name="l00174"></a>00174 <span class="preprocessor">        #region IEnumerable Members</span>
<a name="l00175"></a>00175 <span class="preprocessor"></span>
<a name="l00182"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a7d819d2ba8ffadd29113c811ce043c9f">00182</a>         IEnumerator IEnumerable.GetEnumerator()
<a name="l00183"></a>00183         {
<a name="l00184"></a>00184             <span class="keywordflow">return</span> GetEnumerator();
<a name="l00185"></a>00185         }
<a name="l00186"></a>00186 
<a name="l00187"></a>00187 <span class="preprocessor">        #endregion</span>
<a name="l00188"></a>00188 <span class="preprocessor"></span>
<a name="l00189"></a>00189 <span class="preprocessor">        #region ICloneable Members</span>
<a name="l00190"></a>00190 <span class="preprocessor"></span>
<a name="l00197"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#ae2ed43906a9888a668bcfb815620d9b3">00197</a>         <span class="keyword">public</span> <span class="keywordtype">object</span> Clone()
<a name="l00198"></a>00198         {
<a name="l00199"></a>00199             <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html" title="Represents a collection of SectionData.">SectionDataCollection</a>(<span class="keyword">this</span>);
<a name="l00200"></a>00200         }
<a name="l00201"></a>00201 
<a name="l00202"></a>00202 <span class="preprocessor">        #endregion</span>
<a name="l00203"></a>00203 <span class="preprocessor"></span>
<a name="l00204"></a>00204 <span class="preprocessor">        #region Non-public Members</span>
<a name="l00205"></a>00205 <span class="preprocessor"></span>
<a name="l00209"></a><a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a52a5d6046c6af935aba7db7ffe5024fc">00209</a>         <span class="keyword">private</span> readonly Dictionary&lt;string, SectionData&gt; <a class="code" href="../../d4/dcc/classMinConsole_1_1IniParser_1_1SectionDataCollection.html#a52a5d6046c6af935aba7db7ffe5024fc" title="Data associated to this section.">_sectionData</a>;
<a name="l00210"></a>00210 
<a name="l00211"></a>00211 <span class="preprocessor">        #endregion</span>
<a name="l00212"></a>00212 <span class="preprocessor"></span>
<a name="l00213"></a>00213     }
<a name="l00214"></a>00214 }
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sat Jan 22 2011 22:24:47 for DataExtractor by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
